
#ifndef _DRIVER_LOWPASS_FILTER_H
#define _DRIVER_LOWPASS_FILTER_H

#include "stdint.h"
#include "arm_math.h"



typedef struct
{
	float32_t sf;
	float32_t value_old;
	
}STR_LPF_HDL;


/*!
    \brief      
    \param[in]  none
    \param[out] none
    \retval     none
*/
static float32_t signal_low_pass(STR_LPF_HDL *hdl, float32_t value)
{
	float32_t rslt;
	
	#if 0
	rslt = value * hdl->sf + (1 - hdl->sf) * hdl->value_old;
	#else
	
	rslt = (value - hdl->value_old) * hdl->sf + hdl->value_old;
	
	#endif
	
	hdl->value_old = rslt;
	
	return rslt;
}


#endif


